#! /usr/bin/env python
# -*- coding: utf-8 -*-

__author__ = 'huangjacky'

import sys
from tornado.web import Application
from tornado.ioloop import IOLoop
import init
from config import config
from route import router

reload(sys)
sys.setdefaultencoding('utf-8')

settings = {
    'static_path': config['static_dir'],
    'login_url': '/login',
    'cookie_secret': config['secret_key'],
    'xsrf_cookies': True,
    'debug': True  # 测试,正式环境中需要关闭这个选项
}

def main():
    app = Application(router, ** settings)
    app.listen(config['port'], config['ip'])
    IOLoop.current().start()


if __name__ == '__main__':
    main()